<extend name="template/base_index" />
<block name="area_header">
    <link rel="stylesheet" href="__CSS__/issue_his.css">
</block>

<block name="area_body">
    <div class="issue_mhead">
        <a href ="{:U('UserCenter/index')}"><i class="fa fa-chevron-left"></i></a>
    </div>
    <volist name="product" id="vo">
        <div class="weui_cells issue_top">
            <div>
                <span class="issue_name">{$vo['name']}</span><br/><span class="issue_price"><i class="fa fa-jpy"></i>{$vo['price']}</span>
            </div>
            <div class="img-box">
                <volist name="vo['imglist']" id="img">
                    <div class="img-list"><img src="{$img['path']}" width="100%"></div>
                </volist>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <eq name="vo['status']" value="0">
                        <span>已经售出</span>
                        <a class="issue_delet" data-val="{$vo['id']}"><i class="fa fa-trash"></i>删除</a>
                        <a class="issue_edit" href="{:U('UserCenter/edit_product',array('id' => $vo['id']))}"><i class="fa fa-pencil-square-o"></i>编辑</a>
                    </eq>
                    <eq name="vo['status']" value="1">
                        <a class="issue_delet" data-val="{$vo['id']}"><i class="fa fa-trash"></i>删除</a>
                        <a class="issue_edit" href="{:U('UserCenter/edit_product',array('id' => $vo['id']))}"><i class="fa fa-pencil-square-o"></i>编辑</a>
                    </eq>
                    <eq name="vo['status']" value="-2">
                        <span>商品已经被下架</span>
                        <a class="issue_delet" data-val="{$vo['id']}"><i class="fa fa-trash"></i>删除</a>
                        <a class="issue_edit" href="{:U('UserCenter/edit_product',array('id' => $vo['id']))}"><i class="fa fa-pencil-square-o"></i>编辑</a>
                    </eq>
                </div>
            </div>
        </div>
    </volist>
    <script type="text/javascript">
        $(function(){
            $(".issue_delet").bind("click", function() {
                var id = $(this).attr('data-val');
                $.confirm("您确定要删除该发布吗?", "确认删除?", function() {
                    $.get("{:U('UserCenter/product_delete')}",{id:id},function(res){
                                if(res){
                                    $.toptip('操作成功', 'success');
                                    location.reload();
                                }else{
                                    $.toptip('操作失败', 'error');
                                }
                            }
                    );
                }, function() {
                    //取消操作
                });
            });
        });

    </script>


    <script src="__JS__/jquery-weui.min.js"></script>
</block>